package cate.game.play.base;


import cate.common.table.d.GDSkill;
import cate.game.play.skill.Skill;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.Getter;

import java.util.List;

@NoteClass("目标筛选条件")
@Getter
public class TargetFilterParam {

	@NoteField("目标人数")
	private int targetNum = 1;

	@NoteField("范围")
	private byte scope = GDSkill.Scope.ENEMY;

	@NoteField("是否存活")
	private boolean alive = true;

	@NoteField("特殊目标规则")
	private Byte special;

	@NoteField("排序属性")
	private Integer cAttr;

	@NoteField("排序职业")
	private List<Byte> cJobs;

	@NoteField("排序阵营")
	private List<Byte> cCamps;

	@NoteField("排序技能标签")
	private List<String> cSkillTags;

	@NoteField("排序buff标签")
	private List<String> cBuffTags;

	@NoteField("优先选择目标的pid")
	private List<Integer> topPriorityPids;


	public static TargetFilterParam buildBySkill(Skill skill) {
		TargetFilterParam param = new TargetFilterParam();
		param.alive = !skill.cfg.isEffectType(GDSkill.EffectType.复活);
		param.targetNum = skill.getTargetNum();
		param.scope = skill.cfg.row.tarScope;
		param.special = skill.cfg.getCSpecial();
		param.cAttr = skill.cfg.getCAttr();
		param.cJobs = skill.cfg.getCJobs();
		param.cCamps = skill.cfg.getCCamps();
		param.cSkillTags = skill.cfg.getCSkillTags();
		param.cBuffTags = skill.cfg.getCBuffTags();
		param.topPriorityPids = skill.param.getTopPriorityPids();
		return param;
	}

	public TargetFilterParam targetNumSet(int targetNum) {
		this.targetNum = targetNum;
		return this;
	}

	public TargetFilterParam scopeSet(byte scope) {
		this.scope = scope;
		return this;
	}

	public TargetFilterParam specialSet(byte special){
		this.special = special;
		return this;
	}

	public TargetFilterParam bigAttrSet(int cAttr){
		this.cAttr = cAttr;
		return this;
	}

	public TargetFilterParam smallAttrSet(int cAttr){
		this.cAttr = -cAttr;
		return this;
	}

	public TargetFilterParam jobsSet(List<Byte> jobs) {
		this.cJobs = jobs;
		return this;
	}

	public TargetFilterParam campsSet(List<Byte> camps) {
		this.cCamps = camps;
		return this;
	}

	public TargetFilterParam skillTagsSet(List<String> skillTags) {
		this.cSkillTags = skillTags;
		return this;
	}

	public TargetFilterParam buffTagsSet(List<String> buffTags) {
		this.cBuffTags = buffTags;
		return this;
	}
}
